import { View, Image, Button } from "@tarojs/components"
import Taro from '@tarojs/taro'
import NavBar from "./topbar/topbar";
import { AtImagePicker,AtInput, AtForm,AtTextarea,AtButton} from 'taro-ui'
import { useState } from "react"
import './publish.scss'
import logo from "../calendar/image/logo.jpg";
function publish(){
    const toBack = () => {
        Taro.navigateBack().then()
    }

    const[call,setcall]=useState()             //名字
    const [title,settitle]=useState()            //标题
    const[contment,setcontment]=useState()       //描述
    const[url,seturl]=useState(undefined)       //添加图片
    //名字
    const Changecall = (call) =>{
        setcall(call)
    }
    //标题
    const Changetitle = (title) =>{
        settitle(title)
    }
    //描述
    const Changecontment = (contment) =>{
        setcontment(contment)
    }
    //图片
    const onChange=(url)=>{
        seturl(url)
    }
    const onFail=(mes)=>{
        console.log(mes)
    }
    const onImageClick=(index, file)=>{
        console.log(index, file)
    }
    //发布按钮
    const handleClick = () => {}

    return(
        <View>
            <NavBar title='发布画报' back nback={toBack} />
            {/* <Image src={logo} mode='aspectFit' className="Pic"/> */}
                <AtForm>
                    <AtInput
                        className="name"
                        name='value'
                        title='姓名'
                        type='text'
                        placeholder='请输入姓名'
                        value={call}
                        onChange={Changecall}
                    />
                    <AtInput
                        name='value1'
                        title='标题'
                        type='text'
                        placeholder='请输入标题'
                        value={title}
                        onChange={Changetitle}
                    />
                </AtForm>
                <AtTextarea
                    height='300'
                    value={contment}
                    onChange={Changecontment}
                    maxLength={600}
                    placeholder='描述一下吧！'
                />
                <AtImagePicker
                    mode="aspectFit"
                    files={url}
                    onChange={onChange}
                />
                <AtButton className="sent" onClick={handleClick}  size='normal'>发布</AtButton>
        </View>
    )
}
export default publish
